﻿
using System;
using System.Collections.Generic;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Runtime.Serialization;

using RestfulRIAs.DataContracts;

namespace RestfulRIAs.ServiceContracts
{
	[ServiceContract]
	public interface IBorrowerRestfulService {
	
		[OperationContract]
		[WebInvoke(Method="POST", UriTemplate = "loans/{loanNumber}/borrowers", ResponseFormat = WebMessageFormat.Json)]
		string CreateBorrower(string LOANNUMBER, BorrowerDto Borrower);
		
		[OperationContract]
		[WebGet(UriTemplate = "loans/{loanNumber}/borrowers/{borrowerId}", ResponseFormat = WebMessageFormat.Json)]
		BorrowerDto[] GetBorrowers(string LOANNUMBER, string BORROWERID);

		[OperationContract]
		[WebInvoke(Method="PUT", UriTemplate = "loans/{loanNumber}/borrowers/{borrowerId}", ResponseFormat = WebMessageFormat.Json)]
		BorrowerDto UpdateBorrower(string LOANNUMBER, string BORROWERID, BorrowerDto Borrower);
		
		[OperationContract]
		[WebInvoke(Method="DELETE", UriTemplate = "loans/{loanNumber}/borrowers/{borrowerId}", ResponseFormat = WebMessageFormat.Json)]
		void DeleteBorrower(string LOANNUMBER, string BORROWERID, BorrowerDto Borrower);
	}
	
	[ServiceContract]
	public interface ILoanRestfulService {
	
		[OperationContract]
		[WebInvoke(Method="POST", UriTemplate = "loans/", ResponseFormat = WebMessageFormat.Json)]
		string CreateLoan(LoanDto Loan);
		
		[OperationContract]
		[WebGet(UriTemplate = "loans/{loanNumber}", ResponseFormat = WebMessageFormat.Json)]
		LoanDto[] GetLoans(string LOANNUMBER);

		[OperationContract]
		[WebInvoke(Method="PUT", UriTemplate = "loans/{loanNumber}", ResponseFormat = WebMessageFormat.Json)]
		LoanDto UpdateLoan(string LOANNUMBER, LoanDto Loan);
		
		[OperationContract]
		[WebInvoke(Method="DELETE", UriTemplate = "loans/{loanNumber}", ResponseFormat = WebMessageFormat.Json)]
		void DeleteLoan(string LOANNUMBER, LoanDto Loan);
	}
	
}
